//Source file: C:\\javier\\mario\\Java\\taladro\\control\\Secuencia.java

package taladro.control;

import java.util.*;
import taladro.maquina.*;
import taladro.puerto.*;

/**
 * <p>
 * </p>
 */
public abstract class Secuencia 
{
   
   /**
    * /////////////////////////////////////
    * attributes
    * <p>
    * Represents ...
    * </p>
    */
   protected byte sec[];
   public static int AVANZAR = 0;
   public static int RETROCEDER = 1;
   private int direccion = 0;
   private int secActual = 0;
   private int posActual = 0;
   
   /**
    * /////////////////////////////////////
    * operations
    * <p>
    * Does ...
    * </p><p>
    * @return a byte with ...
    * </p>
    * @roseuid 3F341CC20368
    */
   public byte getNext() 
   {
       if( direccion == AVANZAR )
       {
          ++secActual;
          posActual++;
       }
       else
       {
           posActual--;
          --secActual;
       }
       
       if( secActual >= sec.length )
           secActual = 0;
       if( secActual < 0 )
           secActual = sec.length-1;
       
       return sec[secActual];    
   }
   
   /**
    * end getLast        
    * <p>
    * Does ...
    * </p><p>
    * @return a byte with ...
    * </p>
    * @roseuid 3F341CC2037C
    */
   public byte getCurrent() 
   {        
        return sec[secActual];    
   }
   
   /**
    * @param dir
    * @roseuid 3F352DB70074
    */
   public void setDirection(int dir) 
   {
        direccion = dir;    
   }
   
   /**
    * @param pos
    * @roseuid 3F3716CC028C
    */
   public void setPosActual(int pos) 
   {
       posActual = pos;    
   }
   
   /**
    * @return int
    * @roseuid 3F3717110228
    */
   public int getPosActual() 
   {
    return posActual;    
   }
}
/**
 * 
 * 
 * 
 * 
 *  end Secuencia
 *  
 *  
 *  
 *  
 */
